﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Maticsoft.DBUtility;//请先添加引用

namespace BaoJian.Control
{
    public partial class ImageList : System.Web.UI.UserControl
    {
        public string ColumnID = "";
        public int DocCount = 5;
        public string Region = "beijing";
        public int FocusWidth = 257;
        public int FocusHeight = 192;
        public int TextHeight = 20;

        public string[] imgUrl = new string[5];
        public string[] imgtext = new string[5];
        public string[] newsid = new string[5];

        protected void Page_Load(object sender, EventArgs e)
        {
            string sql = "DefaultImageList '" + ColumnID + "','" + DocCount + "','"+Region+"'";
            
            DataTable dt = DbHelperSQL.Query(sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                if (Region == "beijing")
                {
                    for (int i = 0; i < DocCount && i < dt.Rows.Count; i++)
                    {
                        imgUrl[i] = (dt.Rows[i]["FirstImage"] as string).Replace(@"/uploads", "uploads");
                        imgtext[i] = dt.Rows[i]["Title"] as string;
                        newsid[i] = dt.Rows[i]["OID"].ToString();
                    }
                }
                else
                {
                    for (int i = 0; i < DocCount && i < dt.Rows.Count; i++)
                    {
                        imgUrl[i] = (dt.Rows[i]["FirstImage"] as string).Replace(@"/uploads", "../uploads");
                        imgtext[i] = dt.Rows[i]["Title"] as string;
                        newsid[i] = dt.Rows[i]["OID"].ToString();
                    }
                }
            }

           
        }
    }
}